import {
	defineStore
} from 'pinia';
import {
	basePinia
} from "./index.js";
import {
	canDrawOverlays,
	setTopApp,
	wakeupAndUnlock
} from "@/utils/remindFn.js"
const today = new Date();
export const usePinia = defineStore('plan', {
	state: () => {
		return {
			planList: [],
			remindPlanList: [], //需要提醒的计划事项
			curCheckedDate: `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, '0')}-${today.getDate().toString().padStart(2, '0')}`, //当前需要定时检查计划的日期
		}
	},
	actions: {
		async getCurPlanList() {
			let planList = await this.queryPlanHandle(this.curCheckedDate)
			console.log(planList)
		},
		queryPlanHandle(date) {
			return new Promise(resolve => {
				apiQueryPlan(data).then(res => {
					console.log(res, 'res')
					resolve(res.data)
				}).catch(err => {
					console.log(err, 'err')
				})
			})
		}
	},
	getters: {

	}
})

export const planStore = usePinia(basePinia);